<%@page import="com.system.uitls.ChartUtils"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ui" uri="http://com.am.tag" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ include file="../common.jsp" %>
<%
	String startDate = request.getParameter("startDate");
	String endDate = request.getParameter("endDate");
	String dateType = request.getParameter("dateType");
	pageContext.setAttribute("startDate", startDate);
	pageContext.setAttribute("endDate", endDate);
	pageContext.setAttribute("dateType", dateType);
	pageContext.setAttribute("list", ChartUtils.getCategories(startDate, endDate, dateType));
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'userList.jsp' starting page</title>
    <script type="text/javascript" src="${path}/js/public/grid.js"></script>
    <script type="text/javascript">
    	function doExport()
    	{
    		$.gridToXls(mygrid,"com.system.provider.PatientRecordProvider","看病记录报表.xls");
    	}
    
    	function campusRender(value){
    		if(value == "0"){
    			return "校本部";
    		}else if(value == "1"){
    			return "白云校区";
    		}else if(value == "2"){
    			return "北校区";
    		}else if(value == "3"){
    			return "西校区";
    		}else{
    			return "合计";
    		}
    		
    	}
    </script>
  </head>
  
  <body style="overflow: hidden;">
  
  	<table cellSpacing="0" cellPadding="0" style="width:100%;height:100%;" border="0">
		<tr>
			<td style="width:100%;height:100%;overflow:hidden"  class="windowBody">
				<div id="mess_box" style="width:100%;height:100%;overflow:hidden">
					<ui:Grid id="mygrid" css="width:100%;height:100%"
				    		 onCellClicked="selectedSingleRow2"
				    		 parameters='"startDate":"${startDate}","endDate":"${endDate}","dateType":"${dateType}"'
				    		 dataProvider="com.system.provider.PatientRecordProvider:getData">
				    	<ui:GridField name="person_campus" header="校区" width="20%" align="center" render="campusRender"/>
				    	<c:forEach items="${list}" var="obj">
				    		<ui:GridField name="${obj }" header="${obj}" width="${80/fn:length(list) }%" align="center"/>
				    	</c:forEach>
			    	</ui:Grid>
		    	</div>
		    </td>
		</tr>
  	</table>
  </body>
</html>
